package br.eco.eagua.view;



import android.app.ListActivity;
import android.os.Bundle;
import android.widget.SimpleAdapter;
import br.eco.eagua.R;
import br.eco.eagua.dao.DatabaseHelper;
import br.eco.eagua.dao.ProjetoDAO;

public class RegistroController extends ListActivity {
	
	private DatabaseHelper helper;
	private ProjetoDAO registros;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {		
		super.onCreate(savedInstanceState);
		helper = new DatabaseHelper(this);
		registros = new ProjetoDAO(helper);		
	}
	
	@Override
	protected void onResume() {
				
		String[] from = {"imagem", "data", "hora", "valor"};
		int[] to = {R.id.imagem, R.id.data, R.id.hora, R.id.valor};
		
		SimpleAdapter adapter = new SimpleAdapter(this, registros.ListarRegistros(), R.layout.item_registros, from, to);
		this.setListAdapter(adapter);
		super.onResume();
	}

}
